package com.bifrost.mtentity;

import com.bifrost.util.DateUtils;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.util.Date;
import java.util.Objects;

/**
 *  @Author:Sophia
 *  @Date:2018/7/16
 *  
 */
@Entity
@Table(name = "MT_ORDER_RECORD")
public class MtOrderRecord {
    private String id;
    private String orderNumber;
    private String externalId;
    private Long buyNumber;
    private Double sellPrice;
    private String deliveryTime;
    private String handleTime;
    private Long handleStatus=0L;
    private String errorMessage;
    private String createdTimestamp=DateUtils.format(new Date(),DateUtils.DEFAULT_DATE_FORMAT);
    private String businessOrderNumber;
    private String storeCode;
    private String orderType;

    @Id
    @Column(name = "ID", nullable = false, length = 36)
    @GenericGenerator(name = "system-uuid",strategy = "uuid")
    @GeneratedValue(generator = "system-uuid")
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    @Basic
    @Column(name = "ORDER_NUMBER", nullable = true, length = 200)
    public String getOrderNumber() {
        return orderNumber;
    }

    public void setOrderNumber(String orderNumber) {
        this.orderNumber = orderNumber;
    }

    @Basic
    @Column(name = "EXTERNAL_ID", nullable = true, length = 200)
    public String getExternalId() {
        return externalId;
    }

    public void setExternalId(String externalId) {
        this.externalId = externalId;
    }

    @Basic
    @Column(name = "BUY_NUMBER", nullable = true, precision = 0)
    public Long getBuyNumber() {
        return buyNumber;
    }

    public void setBuyNumber(Long buyNumber) {
        this.buyNumber = buyNumber;
    }

    @Basic
    @Column(name = "SELL_PRICE", nullable = true, precision = 0)
    public Double getSellPrice() {
        return sellPrice;
    }

    public void setSellPrice(Double sellPrice) {
        this.sellPrice = sellPrice;
    }

    @Basic
    @Column(name = "DELIVERY_TIME", nullable = true, length = 100)
    public String getDeliveryTime() {
        return deliveryTime;
    }

    public void setDeliveryTime(String deliveryTime) {
        this.deliveryTime = deliveryTime;
    }

    @Basic
    @Column(name = "HANDLE_TIME", nullable = true, length = 100)
    public String getHandleTime() {
        return handleTime;
    }

    public void setHandleTime(String handleTime) {
        this.handleTime = handleTime;
    }

    @Basic
    @Column(name = "HANDLE_STATUS", nullable = true, precision = 0)
    public Long getHandleStatus() {
        return handleStatus;
    }

    public void setHandleStatus(Long handleStatus) {
        this.handleStatus = handleStatus;
    }

    @Basic
    @Column(name = "ERROR_MESSAGE", nullable = true, length = 200)
    public String getErrorMessage() {
        return errorMessage;
    }

    public void setErrorMessage(String errorMessage) {
        this.errorMessage = errorMessage;
    }

    @Basic
    @Column(name = "CREATED_TIMESTAMP", nullable = true, length = 100)
    public String getCreatedTimestamp() {
        return createdTimestamp;
    }

    public void setCreatedTimestamp(String createdTimestamp) {
        this.createdTimestamp = createdTimestamp;
    }

    @Basic
    @Column(name = "BUSINESS_ORDER_NUMBER", nullable = true, length = 20)
    public String getBusinessOrderNumber() {
        return businessOrderNumber;
    }

    public void setBusinessOrderNumber(String businessOrderNumber) {
        this.businessOrderNumber = businessOrderNumber;
    }

    @Basic
    @Column(name = "STORE_CODE", nullable = true, length = 50)
    public String getStoreCode() {
        return storeCode;
    }

    public void setStoreCode(String storeCode) {
        this.storeCode = storeCode;
    }

    @Basic
    @Column(name = "ORDER_TYPE", nullable = true, length = 100)
    public String getOrderType() {
        return orderType;
    }

    public void setOrderType(String orderType) {
        this.orderType = orderType;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        MtOrderRecord that = (MtOrderRecord) o;
        return Objects.equals(id, that.id) &&
                Objects.equals(orderNumber, that.orderNumber) &&
                Objects.equals(externalId, that.externalId) &&
                Objects.equals(buyNumber, that.buyNumber) &&
                Objects.equals(sellPrice, that.sellPrice) &&
                Objects.equals(deliveryTime, that.deliveryTime) &&
                Objects.equals(handleTime, that.handleTime) &&
                Objects.equals(handleStatus, that.handleStatus) &&
                Objects.equals(errorMessage, that.errorMessage) &&
                Objects.equals(createdTimestamp, that.createdTimestamp) &&
                Objects.equals(businessOrderNumber, that.businessOrderNumber) &&
                Objects.equals(storeCode, that.storeCode) &&
                Objects.equals(orderType, that.orderType);
    }

    @Override
    public int hashCode() {

        return Objects.hash(id, orderNumber, externalId, buyNumber, sellPrice, deliveryTime, handleTime, handleStatus, errorMessage, createdTimestamp, businessOrderNumber, storeCode, orderType);
    }
}
